/**
 * [用户列表模板]
 * @Author: Fu Xiaochun
 * @Email:  fuzhengchun@ling1.org
 */
<template>
	<div>
        <el-table :data="tableData" border v-loading="loading">
			<el-table-column label="昵称" :show-overflow-tooltip="true" min-width="110">
				<template slot-scope="scope">
					<div class="userHead" @click="$router.push(`/user/detail/${scope.row.id}`)">
						<img :src="scope.row.avatar" class="square" />
						{{scope.row.nick_name}}
					</div>
				</template>
			</el-table-column>
			<el-table-column prop="id" label="用户ID" :show-overflow-tooltip="true" min-width="60"></el-table-column>
			<el-table-column prop="gender" label="性别" :show-overflow-tooltip="true" min-width="55">
				<template slot-scope="scope">
					<div v-if="tableData[scope.$index].gender==0">-</div>
					<img src="../../../static/img/nan.png" v-if="tableData[scope.$index].gender==1" class="gender" />
					<img src="../../../static/img/nv.png" v-if="tableData[scope.$index].gender==2" class="gender" />
				</template>
			</el-table-column>
			<el-table-column prop="balance" label="账户余额" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<font color="#F30">{{scope.row.balance | transPrice(2)}}</font>
				</template>
			</el-table-column>
			<el-table-column prop="freeze" label="冻结资金" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<font color="#F30">{{scope.row.user_Frozen_balance | transPrice(2)}}</font>
				</template>
			</el-table-column>
			<!--el-table-column prop="level" label="等级 / 成长值" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<img :src="`/static/img/v${scope.row.level}.png`" class="leav" />{{scope.row.credit_score || 0}}
				</template>
			</el-table-column-->
			<el-table-column prop="mobile" label="手机号码" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					{{scope.row.mobile || "-"}}
				</template>
			</el-table-column>
			<el-table-column prop="reg_channel" label="注册渠道" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<router-link class="blue" :to="`/user/detail/${scope.row.inviter.id}`" v-if="scope.row.inviter">{{scope.row.inviter.nick_name}}</router-link>
					<template v-else>官方注册</template>
				</template>
			</el-table-column>

      <el-table-column prop="reg_time" label="注册时间" :show-overflow-tooltip="true">
      	<template slot-scope="scope">
          <el-tooltip>
            <div class="ell">{{scope.row.time_created | dateFormat}}</div>
            <div slot="content">
              注册时间：{{scope.row.time_created | dateFormat}}<br/><br/>
              微信绑定时间：{{scope.row.weixin_bind_time?(scope.row.weixin_bind_time | dateFormat):'未记录'}}
            </div>
          </el-tooltip>
      	</template>
      </el-table-column>

			<el-table-column prop="subordinate_1" label="下级人数" :show-overflow-tooltip="true">
				<template slot-scope="scope">
                    <span v-if="scope.row.subordinate_1 == 0">-</span>
					<router-link v-else class="blue" :to="`/user/subordinate/${scope.row.id}`">{{scope.row.subordinate_1 + "人"}}</router-link>
				</template>
			</el-table-column>
			<!--el-table-column prop="last_ua" label="最后使用终端" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<span>{{scope.row.last_system}}</span>
				</template>
			</el-table-column-->
			<el-table-column prop="btn" label="操作" :show-overflow-tooltip="true">
				<template slot-scope="scope">
					<router-link class="blue" :to="`/user/detail/${scope.row.id}`">查看</router-link>
				</template>
			</el-table-column>
		</el-table>
    </div>
</template>

<script>
import fetch from '@/api/axios';
import {sysToYuan} from '@/utils/transPrice';
import {tsToDateFormat} from '@/utils/tsToDateFormat';
export default {
    props: {
        tableData: {
            type: Array,
            default: []
        },
        loading: {
            type: Boolean,
            default: false
        }
    },
	data() {
		return {
			//
		}
	},
	filters: {
		transPrice(p){
			return sysToYuan(p, 2);
		},
		dateFormat(t){
			return tsToDateFormat(t, 'MM-dd hh:mm:ss');
		},
	},
	methods:{

    },
	mounted() {

	},
}
</script>
<style lang="scss" scoped>
	.gender {
		width: 26px;
		height: 26px;
	}
	.leav{
		width: 20px;
		height: 20px;
		vertical-align: middle;
		margin-top:-2px;
		margin-right:10px;
	}
</style>
